package com.markhsiu.MiniMQ.remote.transport.netty;

import com.markhsiu.MiniMQ.channel.ChannelProcessor;
import com.markhsiu.MiniMQ.model.Message;

import io.netty.channel.ChannelHandlerContext;

public class NettyChannelProcessor implements ChannelProcessor{

	private ChannelHandlerContext ctx;
	
	@SuppressWarnings("unused")
	private  NettyChannelProcessor() {}
	
	public NettyChannelProcessor(ChannelHandlerContext ctx){
		this.ctx = ctx;
	}
	
	@Override
	public void write(Message message) {
		ctx.write(message);
	}

	@Override
	public void flush() {
		 ctx.flush();
	}

	@Override
	public void writeAndFlush(Message message) {
		ctx.writeAndFlush(message);
	}

}
